<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="my" uri="/mytags" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<jsp:include page="/admin/jsp/common/HtmlHead.jsp"/>
<title>Insert title here</title>
<script type="text/javascript">
function batchAddLesson(courseId){
	document.getElementById('addDialog').style.display = 'block';
	document.getElementById('myFrame').src = "<s:url action="batchAdd" namespace="/admin/lesson"/>?lesson.courseId="+courseId;
}
function hideDialog(){
	document.getElementById('addDialog').style.display = 'none';
}
</script>
</head>
<body>
	<s:a action="edit">
		<s:param name="course.classId" value="course.classId"/>
	添加</s:a>
	<table width="100%">
		<tr>
			<th>课程名称</th>
			<th>所属科目</th>
			<th>授课教师</th>
			<th>操作</th>
		</tr>
		<s:iterator value="courseList">
		<tr>
			<td>
				<my:justify value="name" maxlength="50"/>
			</td>
			<td>
				<s:property value="subjectName"/>
			</td>
			<td>
				<s:property value="teacherName"/>
			</td>
			<td>
				<a href="javascript:batchAddLesson(<s:property value="id"/>)">
					添加课时
				</a>
				<s:a action="list" namespace="/admin/lesson">
					<s:param name="lesson.courseId" value="id"/>
					课时管理
				</s:a>
				<s:a action="edit">
					<s:param name="course.id" value="id"/>
					编辑
				</s:a>
				<s:url id="delUrl" action="delete">
					<s:param name="course.id" value="id"/>
				</s:url>
				<a href="javascript:deleteConfirm('<s:property value="#delUrl"/>')">
					删除
				</a>
			</td>
		</tr>
		</s:iterator>
	</table>
	<div class="page_ctn">
		<my:pagination totalPageCount="pageBean.totalPageCount" totalRecordCount="pageBean.totalRecordCount"
			pageNo="pageBean.pageNo" theme="number">
			<s:param name="course.name" value="@java.net.URLEncoder@encode(course.title,'utf-8')"/>
			<s:param name="course.classId" value="course.classId"/>
		</my:pagination>
	</div>
	<div id="addDialog" style="display:none;position: absolute;width:500px;margin:0 auto;top:50px;background-color: #fff;border:1px #000 solid;padding:10px;">
		<iframe frameborder="0" width="100%" height="400px;" id="myFrame"></iframe>
	</div>
</body>
<jsp:include page="/admin/jsp/common/errorMessage.jsp"/>
</html>